#include <MTSI.h>

class AMI_Agent_receiveMessageI : public FIPA::AMI_Agent_receiveMessage
{
public:

    virtual void ice_response()
    {
    }

    virtual void ice_exception(const Ice::Exception& ex)
    {
        cerr << "receiveMessage AMI call failed:\n" << ex << endl;
    }
};

typedef IceUtil::Handle<AMI_Agent_receiveMessageI> AMI_Agent_receiveMessageIPtr;

MTSI::MTSI()
{
}

MTSI::~MTSI()
{
}

void
MTSI::receiveMessage
(const FIPA::Message& m, 
 const Ice::Current& curr)
{
  AMI_Agent_receiveMessageIPtr cb = new AMI_Agent_receiveMessageI;
  vector<FIPA::AgentPrx>::const_iterator it;

  for (it = m.env.to.begin();
       it != m.env.to.end();
       ++it)
      (*it)->receiveMessage_async(cb, m);
}
